package org.jogdiary2011.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2011-01-23 20:07:31")
/** */
public final class PersonMeta extends org.slim3.datastore.ModelMeta<org.jogdiary2011.model.Person> {

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<org.jogdiary2011.model.Person, java.util.Date> birthDay = new org.slim3.datastore.CoreAttributeMeta<org.jogdiary2011.model.Person, java.util.Date>(this, "birthDay", "birthDay", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> city = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "city", "city");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> country = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "country", "country");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> description = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "description", "description");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> firstName = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "firstName", "firstName");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<org.jogdiary2011.model.Person, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<org.jogdiary2011.model.Person, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> lastName = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "lastName", "lastName");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> nickName = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "nickName", "nickName");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person> sex = new org.slim3.datastore.StringAttributeMeta<org.jogdiary2011.model.Person>(this, "sex", "sex");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<org.jogdiary2011.model.Person, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<org.jogdiary2011.model.Person, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final PersonMeta slim3_singleton = new PersonMeta();

    /**
     * @return the singleton
     */
    public static PersonMeta get() {
       return slim3_singleton;
    }

    /** */
    public PersonMeta() {
        super("Person", org.jogdiary2011.model.Person.class);
    }

    @Override
    public org.jogdiary2011.model.Person entityToModel(com.google.appengine.api.datastore.Entity entity) {
        org.jogdiary2011.model.Person model = new org.jogdiary2011.model.Person();
        model.setBirthDay((java.util.Date) entity.getProperty("birthDay"));
        model.setCity((java.lang.String) entity.getProperty("city"));
        model.setCountry((java.lang.String) entity.getProperty("country"));
        model.setDescription((java.lang.String) entity.getProperty("description"));
        model.setFirstName((java.lang.String) entity.getProperty("firstName"));
        model.setKey(entity.getKey());
        model.setLastName((java.lang.String) entity.getProperty("lastName"));
        model.setNickName((java.lang.String) entity.getProperty("nickName"));
        model.setSex((java.lang.String) entity.getProperty("sex"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        org.jogdiary2011.model.Person m = (org.jogdiary2011.model.Person) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("birthDay", m.getBirthDay());
        entity.setProperty("city", m.getCity());
        entity.setProperty("country", m.getCountry());
        entity.setProperty("description", m.getDescription());
        entity.setProperty("firstName", m.getFirstName());
        entity.setProperty("lastName", m.getLastName());
        entity.setProperty("nickName", m.getNickName());
        entity.setProperty("sex", m.getSex());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        org.jogdiary2011.model.Person m = (org.jogdiary2011.model.Person) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        org.jogdiary2011.model.Person m = (org.jogdiary2011.model.Person) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        org.jogdiary2011.model.Person m = (org.jogdiary2011.model.Person) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        org.jogdiary2011.model.Person m = (org.jogdiary2011.model.Person) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        org.jogdiary2011.model.Person m = (org.jogdiary2011.model.Person) model;
        writer.beginObject();
        org.slim3.datastore.json.JsonCoder encoder = null;
        if(m.getBirthDay() != null){
            writer.setNextPropertyName("birthDay");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getBirthDay());
        }
        if(m.getCity() != null){
            writer.setNextPropertyName("city");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getCity());
        }
        if(m.getCountry() != null){
            writer.setNextPropertyName("country");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getCountry());
        }
        if(m.getDescription() != null){
            writer.setNextPropertyName("description");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getDescription());
        }
        if(m.getFirstName() != null){
            writer.setNextPropertyName("firstName");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getFirstName());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getKey());
        }
        if(m.getLastName() != null){
            writer.setNextPropertyName("lastName");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getLastName());
        }
        if(m.getNickName() != null){
            writer.setNextPropertyName("nickName");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getNickName());
        }
        if(m.getSex() != null){
            writer.setNextPropertyName("sex");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getSex());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder = new org.slim3.datastore.json.Default();
            encoder.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    public org.jogdiary2011.model.Person jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        org.jogdiary2011.model.Person m = new org.jogdiary2011.model.Person();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.JsonCoder decoder = null;
        reader = rootReader.newObjectReader("birthDay");
        decoder = new org.slim3.datastore.json.Default();
        m.setBirthDay(decoder.decode(reader, m.getBirthDay()));
        reader = rootReader.newObjectReader("city");
        decoder = new org.slim3.datastore.json.Default();
        m.setCity(decoder.decode(reader, m.getCity()));
        reader = rootReader.newObjectReader("country");
        decoder = new org.slim3.datastore.json.Default();
        m.setCountry(decoder.decode(reader, m.getCountry()));
        reader = rootReader.newObjectReader("description");
        decoder = new org.slim3.datastore.json.Default();
        m.setDescription(decoder.decode(reader, m.getDescription()));
        reader = rootReader.newObjectReader("firstName");
        decoder = new org.slim3.datastore.json.Default();
        m.setFirstName(decoder.decode(reader, m.getFirstName()));
        reader = rootReader.newObjectReader("key");
        decoder = new org.slim3.datastore.json.Default();
        m.setKey(decoder.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("lastName");
        decoder = new org.slim3.datastore.json.Default();
        m.setLastName(decoder.decode(reader, m.getLastName()));
        reader = rootReader.newObjectReader("nickName");
        decoder = new org.slim3.datastore.json.Default();
        m.setNickName(decoder.decode(reader, m.getNickName()));
        reader = rootReader.newObjectReader("sex");
        decoder = new org.slim3.datastore.json.Default();
        m.setSex(decoder.decode(reader, m.getSex()));
        reader = rootReader.newObjectReader("version");
        decoder = new org.slim3.datastore.json.Default();
        m.setVersion(decoder.decode(reader, m.getVersion()));
    return m;
}
}